#include "Expression.h"
#include "IVisitor.h"

Expression::Expression(const exprTypePtr& body, int nodeId):
    modType(nodeId),
    _body(body)
{
}
    
Expression::~Expression()
{
    
}
    
Ast::AstTypes Expression::type() const
{
    return Ast::Expression;
}
    

exprTypePtr Expression::body()
{
    return _body;
}

void Expression::setBody(const exprTypePtr& body)
{
    _body = body;
}

    
QString Expression::toString() const
{
    return QString("Expression[body=%1]").
                arg(_body ? _body->toString():"");
}
    
void Expression::accept(IVisitor* visitor, const SimpleNodePtr& node)
{
    visitor->visitExpression(node.dynamicCast<Expression>());
}
    
void Expression::traverse(IVisitor* visitor)
{
    if (_body != NULL)
        _body->accept(visitor, _body);
}